|
Do you mean Universal Serial Bus? or some other programming Jargon?
What exactly are you trying to achieve here?
|
|
|
|
|
Hi,
The array(0) is foo when I type it out trough DOM so why cant this work?
Ive tried a lot, please help!
[code]
function handleResponse() {
if(http.readyState == 4){
var response = http.responseText;
var update = new Array();
if(response.indexOf('|' != -1)) {
update = response.split('|');
document.getElementById(update[0]).innerHTML = update[1]; //not working!
//document.getElementById('foo').innerHTML = update[1];//works!
}
}
}
[/code]
|
|
|
|
|
Why are you creating an array that you don't use?
response.indexOf('|' != -1)
should be
response.indexOf('|') != -1
---
b { font-weight: normal; }
|
|
|
|
|
Hi Guffa,
Im getting this XmlHttpResonse "foo|This is foo". That was my intention anyway. Turns out I'm getting a lot of other stuff to so that was my problem, array(0).length was 250 not 3 (foo).
Btw, seems like there is no difference in those two coding techniques for indexOf, they both work, but yours is more good looking!
Thanks! /x
|
|
|
|
|
xaphod wrote:
Btw, seems like there is no difference in those two coding techniques for indexOf, they both work, but yours is more good looking!
Are you kidding? My code works, the other doesn't.
The expression '|' != -1 will always evalute to the value true, as the string '|' always will be different from the number -1. As the indexOf method uses a string parameter, the boolean value true will be converted to the string 'true'. The call response.indexOf('|' != -1) therefore does exactly the same as response.indexOf('true') . Unless the string response starts with the letters 'true', the call will always return a non-zero value.
---
b { font-weight: normal; }
|
|
|
|
|
You're right!
Thanks for sharing!
Best regards /xaphod
|
|
|
|
|
hellow to all ...
i had purchas a dns ..
and i have a website that is hosted in some free webserver ..
how can i direct the domain to this free webserver that have the site ?
thank's a lot
-- modified at 15:05 Saturday 17th September, 2005
|
|
|
|
|
hi there,
I've not tried with this before.
But basically, the page "localstart.asp" will be executed when sending a request to the domain. So if u want to redirect all these requests to the free webserver, just simply modify the page above to redirect these request to the free server.
That's just my thought.
<< >>
|
|
|
|
|
hello everyone.
if i have a html form in the current page and i type in IE's address box
javascript:document.forms[0].action="index2.asp"; then instead of setting the form to post the data to index2.asp it just generates another page just containing "index2.asp" text.
also, if i type javascript:document.forms[0].onsubmit=alert(); it immediately executes alert() showing a messagebox, instead of showing it when i click the submit button.
this has to be done in IE's bar, not in the html page itself.
what am i doing wrong?
|
|
|
|
|
The second one is easy. You set onsubmit to be the return value of the call to alert(), of course it will execute alert() immediately to get the return value to put into onsubmit. If you want onsubmit to contain the code that calls alert, you have to enclose it in quotes.
The first one I haven't figured out yet...
---
b { font-weight: normal; }
|
|
|
|
|
to enclose what in quotes?
please post the full line, so that when i submit the form(not when i press enter, after typing code into the address bar) an empty message box appears.
|
|
|
|
|
Enclose the code in quotes.
document.forms[0].onsubmit="alert();";
---
b { font-weight: normal; }
|
|
|
|
|
that's what i'm trying to tell you. i doesn't work. as soon as i type(or paste) the code in the address bar and hit enter the page changes to a blank page containing only "alert();" without the quotes. right-click -> view source on the page opens notepad containing only "alert();"(without the quotes). have you tried this yourself and it works?
|
|
|
|
|
Oh, now I see.
That is because the code returns a value, that value is used to create a new page. Put void(0); at the end of the code, and it will not create a new page.
The same happens if you have javascript in the href property of a link.
---
b { font-weight: normal; }
|
|
|
|
|
1. setting a string works :
javascript:document.forms[0].action="index2.asp";void(0);
2. setting a function does not work :
javascript:document.forms[0].onsubmit="alert();";void(0);
i've also tried this on a submit button with no luck :
javascript:document.forms[0].elements[5].onclick="alert();";void(0);
in both cases the form submits but no empty alert box is displayed(i've also tried with window.open() instead of alert()).
3. what function should i use while a page is loading so that after the page completely loads, an empty message box would be diplayed. for example:
javascript:document.onPageComplete="alert('Page Loaded');";void(0); //would wait for the page to load and display Page Loaded.
4. what should i use instead of quotes if i try to run a more complex script?
for example:
javascript:document.forms[0].elements[5].onclick="document.forms[0].onsubmit="alert('ok');";void(0);";
i can't use single quotes because these already mark a string. Should I use \' or \" ?
-- modified at 17:46 Saturday 17th September, 2005
|
|
|
|
|
2. You have to assign a function to the event:
.onsubmit = Function("alert();");
3. onload
4. Inside a string surrounded by qoutes, you use \" for a quoute. Inside a string surrounded by apostrophes, you use \' for an apostrophe. Use \\ for \.
Example:
document.forms[0].elements[5].onclick='document.forms[0].onsubmit=\'alert(\\\'ok\\\');\';void(0);';
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote:
2. You have to assign a function to the event:
.onsubmit = Function("alert();");
3. onload
----------------------------------------
2. still nothing. after this:
javascript:document.forms[0].onsubmit=Function("alert();");
i typed this :
javascript:alert(document.forms[0].onsubmit);
i got this:
function anonymous {
alert();
}
i clicked the submit button and still the same. submits, but no alert box.
3. i used document.body.onunload to make it easier to display after clicking a link. same as above. nothing.
do these work for you?
-- modified at 19:40 Saturday 17th September, 2005
|
|
|
|
|
You can't call alert without a parameter.
alert(1);
---
b { font-weight: normal; }
|
|
|
|
|
dude, you are one cool dude
millon thanks...dude
|
|
|
|
|
I am using ASP to create my web page plz can anyone help,
I want to be able to copy a document with images and paste to a field on my form
Thanks
cleanwater
-- modified at 6:51 Friday 7th October, 2005
|
|
|
|
|
Hi all,
How can I print a .pdf or .doc file from javascript without having to open it?
Thanks
Tony
|
|
|
|
|
|
How do I set the size of a page depending upon a value in the web.config file.
Clueless
|
|
|
|
|
hi there,
do u mean that the size of the client browser?
if so, u can control the size of browser depending on the value in web.config
generally, to set size for web page, u need to do this in java script
below is just an example:
window.open("Sample.htm",null, "height=200,width=400");
Hope this helps
<< >>
|
|
|
|
|
Thanks for that I've tried the following and it opens another window, but I've one more problem that you may be able to help with how do I get rid of the original window.
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="testbrowser.WebForm1" %>
<title>WebForm1
function newWindow(newContent)
{
winContent = window.open(newContent,null,'right=0,top=20,width=350,height=350, scrollbars=yes,resizeable=yes');
}
<asp:label id="Label1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server">Test
|
|
|
|