Click here to Skip to main content
15,917,005 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: Okay, This should be simple for you guys. Pin
T M Gray20-May-10 8:34
T M Gray20-May-10 8:34 
AnswerRe: Okay, This should be simple for you guys. Pin
Dr.Walt Fair, PE20-May-10 9:17
professionalDr.Walt Fair, PE20-May-10 9:17 
QuestionIs there a tool for simple multi user access test? Pin
AglaiaMasaki18-May-10 22:52
AglaiaMasaki18-May-10 22:52 
AnswerRe: I found the tool, Jmeter. Pin
AglaiaMasaki19-May-10 0:03
AglaiaMasaki19-May-10 0:03 
QuestionAd Rotators on Orange Webmail page, knew what other sites I'd visited. Pin
mnemonic6918-May-10 20:41
mnemonic6918-May-10 20:41 
AnswerRe: Ad Rotators on Orange Webmail page, knew what other sites I'd visited. Pin
David Skelly18-May-10 22:35
David Skelly18-May-10 22:35 
GeneralRe: Ad Rotators on Orange Webmail page, knew what other sites I'd visited. Pin
mnemonic6919-May-10 11:45
mnemonic6919-May-10 11:45 
QuestiononClick is not working with input type = image. [modified] Pin
codesean18-May-10 10:17
codesean18-May-10 10:17 
I need help with this javascript - ajax code and I'm new to both js and ajax. I have this code that the onClick function is not working. I'm not receiving any errors. I'm expecting the code to return the value for var str within the function getForm(fobj) to to equate to " name = value" when the onclick function executes. Instead I'm getting empty string. Thanks for your help.

ASP
<script>
var req = createXMLHttpRequest();  
function createXMLHttpRequest() {  
var ua;  
if(window.XMLHttpRequest) {  
try {  
ua = new XMLHttpRequest();  
} catch(e) {  
ua = false;  
}  
} else if(window.ActiveXObject) {  
try {  
ua = new ActiveXObject("Microsoft.XMLHTTP");  
} catch(e) {  
ua = false;  
}  
}  
return ua;  
} 
function sendRequest(frm, file) {  
var rnd982g = Math.random();  
var str = "";  
if(str = getForm(frm)) {  
req.open('GET', file+'?'+str+'&amp;rnd982g='+rnd982g);  
req.onreadystatechange = handleResponse;  
req.send(null);  
}  
return false;  
} 
function handleResponse() {  
if(req.readyState == 4){  
var response = req.responseText;  
 
document.getElementById("results").innerHTML = response;  
}  
}   
function getForm(fobj) { 
var str = "";  
var ft = "";  
var fv = "";  
var fn = "";  
var els = "";  
for(var i = 0;i &lt; fobj.elements.length;i++) {  
els = fobj.elements[i];  
ft = els.title;  
fv = els.value;  
fn = els.name; 
switch(els.type) {  
case "image": 
str += fn + "=" + encodeURI(fv) + "&amp;";  
alert ("string is" + str); 
break;  
} // switch  
} // for  
str = str.substr(0,(str.length - 1));  
alert ("string -1 is:  "  + str ); 
return str;  
}  
<script> 
<html> 
<head> 
<head> 
<body> 
<table border=1 cellspacing=0 cellpadding=0 width=850 height=550> 
 <tr>
  <td width=660 valign=top> <div id="results" /> </td> 
  <td width=190 valign=top> 
  <FORM NAME ="form1" METHOD ="POST"> 
 <INPUT type="image" src="2.gif" name ="mod1" value="webmenu1" onclick="sendRequest(this.form, 'test.php' )"  
 onmouseover="this.src='1.gif'" onmouseout="this.src='2.gif'"><br><br> 
 <tr> 
<table> 
</FORM>
</body>
</html>


modified on Tuesday, May 18, 2010 9:25 PM

AnswerRe: onClick is not working with input type = image. Pin
Not Active18-May-10 11:27
mentorNot Active18-May-10 11:27 
Questionwebsite got hacked Pin
Rohit16db18-May-10 2:09
Rohit16db18-May-10 2:09 
AnswerRe: website got hacked Pin
R. Giskard Reventlov18-May-10 2:31
R. Giskard Reventlov18-May-10 2:31 
GeneralRe: website got hacked Pin
Johnny J.20-May-10 2:03
professionalJohnny J.20-May-10 2:03 
QuestionWeb Development Software? Pin
soterios17-May-10 3:30
soterios17-May-10 3:30 
AnswerRe: Web Development Software? Pin
David Mujica17-May-10 6:21
David Mujica17-May-10 6:21 
AnswerRe: Web Development Software? Pin
Not Active17-May-10 7:19
mentorNot Active17-May-10 7:19 
QuestionMCTS Certification Pin
yadlaprasad16-May-10 20:06
yadlaprasad16-May-10 20:06 
AnswerRe: MCTS Certification Pin
The Man from U.N.C.L.E.17-May-10 7:34
The Man from U.N.C.L.E.17-May-10 7:34 
Question">" problems in PHP statement Pin
SNArruda15-May-10 6:06
SNArruda15-May-10 6:06 
Questionwebsite ads Pin
mnemonic6913-May-10 10:17
mnemonic6913-May-10 10:17 
AnswerRe: website ads Pin
T M Gray19-May-10 12:04
T M Gray19-May-10 12:04 
QuestionReading a client-side INI into javascript Pin
bill bradley11-May-10 16:45
bill bradley11-May-10 16:45 
AnswerRe: Reading a client-side INI into javascript Pin
enhzflep11-May-10 18:05
enhzflep11-May-10 18:05 
Questionworking with weather.com free html applet Pin
bill bradley11-May-10 16:41
bill bradley11-May-10 16:41 
QuestionClient-Side Start-Up Script Pin
bill bradley11-May-10 16:36
bill bradley11-May-10 16:36 
QuestionFREE php jquery forms with recaptcha Pin
Yoingco11-May-10 11:42
Yoingco11-May-10 11:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.