|
hello,
You can try something like below to append the "http://"
function gotourl() {
var url = document.getElementById('url').value;
if (url.length > 7) {
if (url.substring(0, 7) != "http://") {
url = "http://" + url;
}
}
self.frames['ifrm'].location.href = url ; //document.getElementById('url').value;
document.location.href=redirecturl;
}
|
|
|
|
|
don't forget "http://" is not the only protocol available for web pages (e.g. "https://").
I would be more inclined to check for the presence of "://" and if it is not present then I would add the "http://" prefix. If it is present then you could assume another protocol is used.
in the last example if someone entered "https://www.example.com" then you would end up trying to direct to "http://https://www.example.com" - which is of course invalid
EDIT: Actually meant to reply this to the OP
return 5;
|
|
|
|
|
yeah, I'm not worrying about it. The majority of people that will be using this site do not know any other protocols besides http; this is for a school website.
|
|
|
|
|
That is fair enough, thou I would suggest showing that you have added "http://" by updating the URL field once you have changed the value. This was they can see exactly where they are being directed, plus it will help them to know about "http://"
return 5;
|
|
|
|
|
Hi Everyone,
Can anyone help me in xsl drop down which i need to display the selected value. I have two pages.
First Page
I have written a html tag in xsl which has six options say one,two....
After selecting one of the value it is stored in the database.
Second Page
Here also I have written the same html tag in xsl. but here the issue is i need to display the selected value which is retrieved from database.
Please let me know if any one has a sample code
Thanks in Advance.
Regards,
Manowj
|
|
|
|
|
In which technology?
sunaSaRa Imdadhusen
+91 99095 44184
+91 02767 284464
|
|
|
|
|
Hello Friends,
I have a javascript function of enabling and disabling a radio button on the selection of another radio button on the same form.
The function is :-
function GetRadioButtonValue()
{
if (document.getElementById("ctl00_Main_RadioButtonList2_0").checked==true)
{
document.getElementById("ctl00_Main_RadioButtonList1_2").disabled=true;
$find('ctl00_Main_AutoCompleteExtender2').set_contextKey(document.getElementById("ctl00_Main_hdl4").value);
}
else if (document.getElementById("ctl00_Main_RadioButtonList2_0").checked==false)
{
document.getElementById("ctl00_Main_RadioButtonList1_2").disabled=false;
$find('ctl00_Main_AutoCompleteExtender2').set_contextKey(document.getElementById("ctl00_Main_hdl5").value);
}
}
The same function is successfully running on Mozilla and performing the necessary operation but not working on chrome. Why this is happening I am not able to get. Kindly help.
Thanks
Varun Sareen (Dot Net Developer)
|
|
|
|
|
Hi,
Is there a debug function in Chrome ? If so, you should debug your script and see where the problem is (it could be document.GetElementById that returns a null value, because it may not be supported by Chrome).
First of all, you need to check which values are returned by the methods you're using ; once you've found them, you have to replace them by ones that Chrome recognizes.
Making a web site compatible for all browsers can really be a tricky task.
|
|
|
|
|
Hi
I have a javascript function that is applied to a textbox onkeyup so that when a user puts in a date in the format of dd/mm/yyyy it puts in the forward slashes. It also stops the user exceeding ten characters. However, when the user uses the backspace button, whilst the numbers are deleted, unless you keep down on the button, I can't get the backspace button to move back beyond the slashes.
Here is my code, and I have highlighted in bold the bit that is not working:
function DateInputUpdate(input) {
if ( input.value.length == 2 || input.value.length == 5 )
input.value = input.value + dateSep;
if (input.value.length > dateFormat.length) {
input.value = input.value.substring(0, dateFormat.length);
if (event.keyCode == 8) {
if (input.value.length == 3 || input.value.length == 6) {
input.value = input.value.substring(input.value.length, input.value.length - 1);
}
}
}
}
Can someone please advise me what I need to do or change? I don't particular wish to delete the slashes, more to ignore them or skip over them that's my ideal solution.
Thanks
|
|
|
|
|
Now you're just cross-posting, which is a no-no here! I meant that your original post should have been made here, not to repeat it here. And I've already told you how to fix it. Oh well, never mind - here, this works (in IE):
function DateInputUpdate(input) {
if (event.keyCode == 8) {
if (input.value.length == 3 || input.value.length == 6) {
input.value = input.value.substring(0,input.value.length-1);
}
} else {
if ( input.value.length == 2 || input.value.length == 5 )
input.value = input.value + '/';
if (input.value.length > 10) {
input.value = input.value.substring(0, 10);
}
}
}
|
|
|
|
|
hi friends..
am developing visitor tracking concept in my webpage. aspx page could be converted into html page and its corresponding functionality page calling from javascript in html page. while am call to the aspx page its going to the loop..
lik
loaded to html page --> call to aspx page (at the end of the page call to html page(same page))--> html page which is previous one..
i unable to stop the loop in the above structured prob.. i may be confusing u.. but this is prob.. anyone can help to call aspx page functionality from html page using javascript
thanks in advance..
|
|
|
|
|
The reason you can't stop the loop issue is because of a mistake in the logic of your tracking system. Please consider the following pointers:
* Why would you want to reload the html page after its already displayed in the browser, this provides huge overhead
* Why not simply have a seperate aspx page that tracks page views and load this in at the end using javascript and ajax
Simple example
Load page -> on page loaded event call tracking.aspx using Ajax
To keep track of which pages are being loaded you will need to pass some data allong to the tracking.aspx in either the querystring or the request body.
|
|
|
|
|
Please share your code. we will try.
|
|
|
|
|
Please share your code. we will try.
|
|
|
|
|
for jquery transfer effect we always mention from element and to element but if i need to show a div just center in page with transfer effect what i need to do. is there any good jquery plug in by which i can position html object like div, span,button etc anywhere in the page with transfer effect and also where i don't have to mention "to element like transfer effect" with minimum coding. please guide me.
thanks
tbhattacharjee
|
|
|
|
|
|
Hi
I have an application that uses html select tag.
My application provides different font sizes. When I am selecting font size which is more than current value.
My HTML Select tag is enlarging accordingly but when I am reducing font size , my select tag is not reducing accordingly.
I am still seeing large dropdown image. Can you please suggest how can i reduce drop down size.
Please find below example.
<html>
<script language="javascript">
function ok_clicked()
{
document.getElementById('sel1').style.fontSize = 17;
}
function ok2_clicked()
{
document.getElementById('sel1').style.fontSize = 9;
}
</script>
<body>
<select id="sel1" style="font-size: 13px;">
<option>Volvo</option>
<option>Saab</option>
<option>Mercedes</option>
<option>Audi</option>
</select>
<input type="button" name="Go2224" value="OK" onClick="ok_clicked();">
<input type="button" name="Go2222" value="Decrease font" onClick="ok2_clicked();">
</body>
</html>
|
|
|
|
|
Works in Chrome. So maybe it is the browser fault?
Wout Louwers
|
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<script type="text/javascript">
function ok_clicked(){
document.getElementById('sel1').style.fontSize = '17px';
}
function ok2_clicked(){
document.getElementById('sel1').style.fontSize = '9px';
}
</script>
<body>
<select id="sel1" style="font-size: 13px;">
<option>Volvo</option>
<option>Saab</option>
<option>Mercedes</option>
<option>Audi</option>
</select>
<input type="button" name="Go2224" value="OK" onclick="ok_clicked();">
<input type="button" name="Go2222" value="Decrease font" onclick="ok2_clicked();">
</body>
</html>
modified on Tuesday, November 30, 2010 8:40 AM
|
|
|
|
|
salmonraju wrote: document.getElementById('sel1').style.fontSize = 17;
Write
document.getElementById("sel1").setAttribute("style", "font-size: 13px");
Instead, It may work.
Regards,
Hiren.
"The more we give of anything, the more we shall get back." - Grace Speare
(you can consider this quote while giving vote also)
Microsoft Dynamics CRM
|
|
|
|
|
document.write('<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"found.htm\"+ i +"\" rel=\"iframe title=\"Hidden Gift! :: :: width: 800; height: 520"+ i +"\" class=\"lightview\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>')
Ok... I cant even post the code... will some one knowledgeable email me>
|
|
|
|
|
You are new here, so first, welcome.
Now, some tips.
1) Start by reading this, How to get an answer to your question[^].
2) Provide a clear description of what are trying to accomplish and what problems you are encountering. Don't expect that everyone knows what you are doing, what tools you are using or what, if anything, you have tried to solve the issue.
3) Don't ask for anyone to email the answer. This is a public site and you have asked the question publically. It would be rude to hide the answer from anyone else that may be having the same issue.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
You have the single and double quotes round the wrong way.
|
|
|
|
|
1. Your first set of single quotes and double quotes are the wrong way around
2. You are trying to use escape character for double quotes in a single quote string
3. You are not closing you IMG tag
4. You are using unneeded escape characters to close you A and DIV tags (assuming you have actually opened these tags somewhere)
try...
document.write('<img src="' + snowscr + '" border="0"/></a></div>');
tip...
use formatting options to insert < and >
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hy,
I have two ASP.net applications which are running simultaneously (p1,p2). If i am working on application p1, i have to restart the clock of application p2 also.For this i have written a java script code which works perfectly on my machine but gives error in server.
Here is my code
string strOut = @"
<SCRIPT language='JavaScript'>
var tparent;
alert('In PC.SearchResult.ascx Script');
debugger;
try{
if(parent.EnableClock == null)
{
alert(' In PC.SearchResult.ascx Script:parent.enableclock=null');
alert(parent.parent.EnableClock);
if(parent.parent.EnableClock == null)
{
alert('In PC.SearchResult.ascx Script: parent.parent.enableclock=null');
tparent = parent.parent.parent;
}
else
{
alert('In PC.SearchResult.ascx Script: parent.parent.enableclock!=null');
tparent = parent.parent;
}
}
else
{
alert('In PC.SearchResult.ascx Script: parent.enableclock!=null');
tparent = parent;
}
alert('The value of tparent is');
alert(tparent.value);
tparent.resetClock();
tparent.EnableClock = true;
alert(" + Session.Timeout.ToString() + ");" +
"tparent.startClock(" + Session.Timeout.ToString() + " );} catch (err){alert(err.message)}</SCRIPT>";
// string strOut = @"<SCRIPT language='JavaScript'>try{var tparent;if(parent.EnableClock == null){if(parent.parent.EnableClock == null){tparent = parent.parent.parent;}else{tparent = parent.parent;}}else{tparent = parent;} tparent.resetClock();tparent.EnableClock = true;tparent.startClock(" + Session.Timeout.ToString() + ");}catch(err){alert(err.message);}</SCRIPT>";
Response.Write(strOut);
The error that i get is when the debugger goes on "parent.parent",it says "ACCESS IS DENIED"
Please help
|
|
|
|