JavaScript - Frm Is Undefined Error After Revamped Website
I have a webpage that gives a quote (simple math). I recently revamped my entire website and when I went to place the page into the new site it will not work. It seems to not be doing anything at all.
the page is at www.rwinvite.com/quote.html it uses quote.js which is in the same directory with the page. the html and js code is long, not complicated, but there are a lot of variables. This was working before I had the website redone, but I have no idea. I did run firebug and it tells me... frm is undefined calc()quote.js (line 6) onclick()quote.html (line 1) [Break on this error] var n1 = frm.envelope.options[frm....x].value; if (isNaN(n1)) { n1 = 0; } (line 6) But in line 3 & 4 I have function calc(){ var frm = document.form1; doesn't that define the form? Similar Tutorialsi am getting an error according to firebug of 'id_con is undefined'.i have made sure all entries are correct and i cannot see how to fix this error. i would be grateful if someone could show me how to correct this error. the error is occuring on this line: Code: itemlist+= items[i].id_con.substr(3)+","; Code: <script src="js/jquery.js"></script> <script src="js/flexigrid.js"></script> <link rel="stylesheet" href="css/flexigrid/flexigrid.css" type="text/css" /> <script type="text/javascript"> $(function() { $("#flex1").flexigrid( { url: 'staff.php', dataType: 'json', colModel : [ {display: 'ID', name : 'id_con', width : 40, sortable : true, align: 'left'}, {display: 'Name', name : 'name_con', width : 150, edit: true, sortable : true, align: 'left'}, {display: 'Email', name : 'email_con', width : 150, sortable : true, align: 'left'}, {display: 'Phone', name : 'phone_con', width : 250, sortable : true, align: 'left'}, {display: 'Mobile', name : 'mobile_con', width : 150, sortable : true, align: 'left'}, {display: 'Fax', name : 'fax_con', width : 150, sortable : true, align: 'left'}, {display: 'Notes', name : 'notes_con', width : 250, sortable : true, align: 'left'} ], buttons : [ {name: 'Add', bclass: 'edit', onpress : test}, {separator: true}, {name: 'Edit', bclass: 'edit', onpress : test}, {separator: true}, {name: 'Delete', bclass: 'delete', onpress : test}, {separator: true} ], searchitems : [ {display: 'Name', name : 'name_con', isdefault: true}, {display: 'Email', name : 'email_con'} ], sortname: "id_con", sortorder: "asc", usepager: true, title: "Staff", useRp: true, rp: 10, showTableToggleBtn: false, resizable: false, autowidth: true, autoheight: true, singleSelect: true } ); }); function test(com,grid) { if($('.trSelected',grid).length>0){ if(confirm('Delete ' + $('.trSelected',grid).length + ' items?')){ var items = $('.trSelected',grid); var itemlist =''; for(i=0;i<items.length;i++){ itemlist+= items[i].id_con.substr(3)+","; } $.ajax({ type: "POST", dataType: "json", url: "delete1.php", data: "items="+itemlist, success: function(data){ alert("Query: "+data.query+" - Total affected rows: "+data.total); $("#flex1").flexReload(); } }); } else if (com=='Add') { alert('Add New Item'); } else if (com=='Edit') { alert('Edit Item'); } } $('b.top').click ( function () { $(this).parent().toggleClass('fh'); } ); } </script> I am trying to build a status string for all the checkboxes on a form. If the checkbox is checked add 127 to the string else add 0 to the string. All works fine until i have just 1 checkbox on the form. I then get an undefined error from alert(checkBoxes.length); Any ideas ? Code: HTML <form name="myform" method="POST" action="" onsubmit="return checkTheBox();"> <ul> <li> <input type="checkbox" name="col_box[]" /> </li> <li> <input type="checkbox" name="col_box[]" /> </li> </ul> <input type="submit" value="Submit Form" /> </form> JAVASCRIPT <script type = "text/javascript"> function checkTheBox() { var checkbox_status =""; var checkBoxes = document.myform.elements['col_box[]']; alert(checkBoxes.length); for (i = 0; i < checkBoxes.length; i++){ if(document.myform["col_box[]"][i].checked){ checkbox_status = checkbox_status + "127,"; } else { checkbox_status = checkbox_status + "0,"; } } alert (checkbox_status); } </script> Hi, I'm not sure did I post this to the right area, but here's my problem... Let's make this simple, I am totally newbie in coding. I installed a lightbox patch to FCKeditor, and I tried to modify it a bit so I could add a title into it. I kind of managed but... Here's the html code which I added to the html file: Code: <div> <br /> <input id="txtTitleLightBox" style="width: 100%" type="text" /> </div> And these are the modified codes which I added to the js file: Code: var rel = oLink.rel; if (rel) { var type; if (rel.indexOf("[") > 0) type = rel.substring(0,rel.indexOf("[")); else type = rel; var oE = GetE('rad'+type); if (oE) { GetE('txtTitleLightBox').value= title; GetE('txtGroupLightBox').value= rel.substring(rel.indexOf("[")+1, rel.indexOf("]")); GetE('chkLightBox').checked = true; GetE('rad'+type).checked = true; } } Code: if (GetE('chkLightBox').checked && oLink) { var rel = "lightbox" var rad = document.getElementsByName('radLightBoxType') for (var i=0; i < rad.length; i++) { if (rad[i].checked) { rel = rad[i].value; break; } } oLink.title = title var title = GetE('txtTitleLightBox').value = title; oLink.rel = rel var group = GetE('txtGroupLightBox').value if (group) { oLink.rel += "[" + group + "]" } } And what I added as new code were Code: oLink.title = title var title = GetE('txtTitleLightBox').value = title; and Code: GetE('txtTitleLightBox').value= title; The result is (eg) this kind of html text: Code: <a title="undefined" rel="lightbox" href="image/path"><img width="200" height="113" alt="" src="image/path" /></a> So the title is undefined even if I fill something to the txtTitleJavaScript box... If you want to investigate the full files, they are he http://jump.fm/IYOXH .. thanks :s Hi All, In one of my php page I have a form where I am displaying a table. The First row is having the drop down and the second row is a text field. Now the problem is that based on the drop down value choosed I have to set some field in text field. For this I am calling a javascript function but when I am trying to set the value in the text field which is still not into picture when this function is called it is showing the error that the field is not defined. Can Anyone tell how I can get access to a field which is yet not defined. I even tried to make a hidden field before drop down and tried to set some value for that still I am facing the same problem. Can anyone help me out ... We use Microsoft Dynamics CRM, which allows you to use JavaScript on your forms (as it's a web-based solution). I created my very first, very simple script, which just checks to see if a Field is popluated, and if it is, a pop-up window appears. However, I keep getting this error: "Error:'Form_OnLoad' is undefined" This is my Code Code: // ------------- // // Microsoft Dynamics CRM 2011 JavaScript // Name: Account Pop-up // Modified: 29 October 2014 // ------------- // function Form_OnLoad() { GetValueFromCRMField(); } function GetValueFromCRMField() { //Get the Value of Alert and Set to a Variable var getSubject = Xrm.Page.getAttribute("bitc_Alert").getValue(); // If the Subject Field is Populated if (getSubject == true) //Pop-up Window in CRM alert(getSubject); } Can anyone see what I've done wrong. I must have scanned this a dozen times, and I'm going cross-eyed. Thanks in advance for any insight or help. Brian Hello, I am trying to add a simple script to my CSS menu for a little bit more eye candy. However, when I add the script - it causes issues in my online store (ex; the javascript-powered one page checkout stops working). Here is the exact error from the error console: Quote: Error: jQuery.validator is undefined Source File: https://www.gem-tech.com/store/pc/onepagecheckout.asp Line: 288 And here is the exact script: Quote: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script type="text/javascript" src="jquery.hoverIntent.minified.js"></script> <script type="text/javascript"> $(document).ready(function() { function megaHoverOver(){ $(this).find(".sub").stop().fadeTo('fast', 1).show(); //Calculate width of all ul's (function($) { jQuery.fn.calcSubWidth = function() { rowWidth = 0; //Calculate row $(this).find("ul").each(function() { rowWidth += $(this).width(); }); }; })(jQuery); if ( $(this).find(".row").length > 0 ) { //If row exists... var biggestRow = 0; //Calculate each row $(this).find(".row").each(function() { $(this).calcSubWidth(); //Find biggest row if(rowWidth > biggestRow) { biggestRow = rowWidth; } }); //Set width $(this).find(".sub").css({'width' :biggestRow}); $(this).find(".row:last").css({'margin':'0'}); } else { //If row does not exist... $(this).calcSubWidth(); //Set Width $(this).find(".sub").css({'width' : rowWidth}); } } function megaHoverOut(){ $(this).find(".sub").stop().fadeTo('fast', 0, function() { $(this).hide(); }); } var config = { sensitivity: 2, // number = sensitivity threshold (must be 1 or higher) interval: 100, // number = milliseconds for onMouseOver polling interval over: megaHoverOver, // function = onMouseOver callback (REQUIRED) timeout: 500, // number = milliseconds delay before onMouseOut out: megaHoverOut // function = onMouseOut callback (REQUIRED) }; $("ul#topnav li .sub").css({'opacity':'0'}); $("ul#topnav li").hoverIntent(config); }); </script> I believe there is some sort of conflict? Not sure though. Any input on this? Thanks, I have a bug that is only seeming to effect IE 8:. It seems to have a problem with this line: theSelectBox.selectedIndex = -1; This is where my full page is: http://www.mauirealestate.net/advancedsearch-rets.php Also has a weird display issue in IE8, but not in "compatibility view", which the bug may fix. Works and looks beautiful is Safari and Firefox. Any suggestions are helpful. Hello, can you tell me why this code gives me undefined error? You can see the code in action he open this link http://www.w3schools.com/cn/html/try...=tryhtml_basic and paste this code on the left side of the webpage, then press 'edit and click me' heres the full code: Code: <html><head><title>eink</title></head> <body onload="aaa()"> <script type="text/javascript"> function aaa() { var word2 = document.getElementById('word'), letters = word2.innerHTML.split(''), spanified; for (var k = 0, j = letters.length; k < j; k++) { spanified += '<span class="style101">' + letters[k] + '</span>'; } word2.innerHTML = spanified; } </script> <style type="text/css"> .style101 { background-color: #FF0000; } </style> <h1 id="word">HOUSE</h1> </body> </html> Here is a picture, of how it looks: I am trying to add a green tick or red cross to my form so that the user will know if they have filled out the form correctly before submitting it and getting told that they need to fill out this or correct that. I have added NAME to each form field and have been using this to read the content but for some reason I am unable to read what is in the field I get the error, 'undefined'. this is what code I have started on... Code: function checkValidFormInput(id, noCheck) { if (noCheck == '') { var idValue = document.getElementsByName(id); if (id == 'customerName') { alert(id); alert(idValue.value); if (idValue != '') { document.getElementsByName(id + 'Img').innerHTML = '<img alt=/"/" src=/"/">'; } } if (id == 'customerEmail') { if (idValue != '') { document.getElementsByName(id + 'Img').innerHTML = '<img alt=/"/" src=/"/">'; } } } } my code is still in the early stages and is missing the other parts to place a red cross, as the moment i am working on placing the green tick. Can anyone spot what I have wrong in my code that is causing it not to read the form field. my form field is coded as so.. Code: <li class="value"> <input type="text" autocomplete="off" name="customerName" value="<?=$fullname;?>" style="width: 200px;" onChange="checkValidFormInput(this.name, '');"> <div style="float: left;" id="customerNameImg"></div><br style="clear:both"> </li> I get "Microsoft JScript runtime error: '$' is undefined" with the javascript below. How should I troubleshoot this? <script type="text/javascript" language="javascript"> function ShowPopup() { $('#mask').show(); $('#<%=pnlpopup.ClientID %>').show(); } function HidePopup() { $('#mask').hide(); $('#<%=pnlpopup.ClientID %>').hide(); } $(".btnClose").live('click', function () { HidePopup(); }); </script> Hey, I have made/modifying a script that I can create AJAX objects on the fly. It is working fine in Chrome, FF, Opera, Safari but not IE -.- IE = nightmare Code: function ajax_object() { this.receive = function(serverAJAXpage, whileLoading, onDone, dataIntoDivID) { this.xmlHttp = createAjaxObject(); this.serverAJAXpage = serverAJAXpage; this.xmlHttp.open("GET", this.serverAJAXpage, true); this.xmlHttp.send(); this.xmlHttp.onreadystatechange = function() { if (this.readyState == 1) { eval(whileLoading); //document.getElementById(mydiv).innerHTML=this.responseText; } if (this.readyState == 4) { eval(onDone); if (typeof dataIntoDivID != "undefined") { document.getElementById(dataIntoDivID).innerHTML = this.responseText; } } } } } function createAjaxObject() { var xmlHttp=null; try { xmlHttp=new XMLHttpRequest(); } catch (e) { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } There is the function that handles the object and here is the objects being used: Code: <script> var onlineUsersAJAX = new ajax_object(); onlineUsersAJAX.receive('ajax/onlineUsers.php', '', '', 'onlineUsers'); var recentPostsAJAX = new ajax_object(); recentPostsAJAX.receive('ajax/recentPosts.php', '', '', 'recentThreads'); </script> IE throws the error: 'ajax_object' is undefined Thank you to anyone that can help =) Hi, I have an image slider that uses the: jquery.min.js file this basically slides up and down smoothly when clicked. I then added a Jquery accordian menu. When I put the 2 together the menu doesn't work it just stays fully expanded. As soon as I remove jquery.min.js it works fine but then the slider doesn't. What could this be please? Thanks alot Joe I know I shouldn't be having this problem at this stage. But what have I done wrong? I have my main page, I have my onload page and in that onload page I call a function: And then I get the error message: Fatal error: Call to undefined function OpenChat() The main page code (I've cut out the irrelevant scripts); Code: <?php session_start(); if (!(isset($_SESSION['login']) && $_SESSION['login'] !='')){ header ("Location: Welcome.php"); } $Sfullname=$_SESSION['fullname']; $SMyPId=$_SESSION['MyPId']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <html> <title></title> <head> <script type="text/javascript"> function OpenChat(Msg){ loadgetdiv(); document.getElementById('<?php echo $Newdiv; ?>').style.display="block"; loadChatComplex('<?php echo $NewThisFile; ?>','<?php echo $Newdiv; ?>',Msg); } </script> <script type="text/javascript"> function loadChatCheck(File,ID,Tile,TID){ loadQuickCheck(File,ID); dodo = setInterval(function(){loadQuickCheck(Tile,TID)},5000); } </script> <script type="text/javascript"> function loadQuickCheck(File,ID){ if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ document.getElementById(ID).innerHTML=xmlhttp.responseText; malaky = setInterval(function(){loadQuickCheck(File,ID)},20000); } } xmlhttp.open("POST",File,true); xmlhttp.send(); } </script> </head> <body onload="loadChatCheck('getCheckNewMessages.php','txtHintCheckNewMessage','getFriendsOnline.php','txtHintShowFriends')"> <div class="mainpage"> <?php include("headermenu.php"); ?> <div id="txtHintShowFriends"></div> <div id="txtHintCheckNewMessage"></div> <br /><br /> </body> </html> AND the onload/getCheckNewMessages.php is PHP Code: <?php session_start(); if (!(isset($_SESSION['login']) && $_SESSION['login'] !='')){ header ("Location: Welcome.php"); } $SMyPId=$_SESSION['MyPId']; include("dbconnect.php"); $result = mysql_query("SELECT COUNT(*) as newchat FROM chat WHERE chattee='{$SMyPId}' AND stat='new'"); $row = mysql_fetch_assoc($result); $total=$row['newchat']; echo 'This is ' . $total .'<br />'; if ($total >=1){ $result = mysql_query("SELECT * FROM chat WHERE chattee='{$SMyPId}' AND stat='new'"); while($row = mysql_fetch_array($result)){ $doormouse=$doormouse . ';' . $row['ChatID']; } $listees=explode(';',$doormouse); foreach($listees as $listor){ echo 'This is ' . $listor . '<br />'; $result = mysql_query("SELECT * FROM chat INNER JOIN allusers ON chat.chatter=allusers.PId WHERE chat.ChatID='{$listor}' "); while($row = mysql_fetch_array($result)){ echo "{$SMyPId};{$row['chatter']};{$row['fullname']};{$row['ref']}"; } echo $battlebox . '<br />'; $steptoe=OpenChat($battlebox); } $sql="UPDATE chat set stat='' WHERE ChatID='{$chatID}' "; mysql_query($sql,$con) or die(mysql_error()); } ?> Needless to say I am trying to create an instant chat. i keep getting error Call to undefined function codeandurl() below is my code PHP Code: <?php $value= strip_tags(get_field('link',$post)); $resultid=get_field('resultid',$post); codeandurl($resultid,$value); ?> <div id="result"></div> <script type="text/javascript"> function codeandurl(resultid,url){ $( "#result" ).text(resultid); $( "#result" ).dialog({ modal: true, buttons: { Ok: function() { $( this ).dialog( "close" ); } } }); window.open(url); return false; } </script> Hi everyone, I'm using a JavaScript to upload multiple files, namely this one: http://valums.com/ajax-upload/ The script has the ability to post additional parameters to the server, by calling the function setParams Code: var doktyp = "default"; var uploader = new qq.FileUploader({ element: document.getElementById('file-uploader-scope'), action: 'uploads.php', // additional data to send, name-value pairs debug: true, onSubmit: uploader.setParams ({ dateityp: getCheckedValue(document.forms['doktyp'].elements['dateityp']), comment: jQuery('#dateityp').val() }) }); Without the onSubmit: part the script works well and does as it's supposed to, but with it FireBug reports "uploader is undefined" und the script seizes to function. Now JavaScript istn't my strong suit, so I have been reading up on this for the last two hours, tried calling that function from a different place, tried to modify it, but no luck; the error remains the same (or slightly different; if I point at the class in question directly, the function doesnt work...). I would appreciate any advice you could give. Hello I have a php page in which I declared a js variable... right at the top of the page... <script type="text/javascript"> var tester = 0; </script> Later in the page I test this variable... <script type="text/javascript"> if (tester==1){ do some stuff!! } </script> But I keep getting an error variable _tester undefined Am I missing something obvious... I am new to js... but this seems really straightforward I had some code written for me. Basically it outputs something like this based on user input: Code: <span>name 1 - <a href=\"test1b\" rel="nofollow" target=\"_blank\">test1a</a> - $12</span><br/> <span>name 2- <a href=\"test2b\" rel="nofollow" target=\"_blank\">test2a</a> - $24</span><br/> What it used to look like: Code: /** * @FUNCTION: finalize :: PUBLIC * This is a shorter version of the codes you * had before and also have a more faster speed */ $.finalize = function(g) { /* Setting global variables */ var i,k,d,p,j,n=0,t=[],f=[],preview=false,addbr='',addExtra='', o=document.getElementsByTagName('div'), s=document.getElementById(g), /* Creating getName function */ getName=function(o){ /* Setting getName global variables */ var i,n= ['Motherboard','CPU','RAM','Video Card', 'Hard Drive','Power Supply','Case', 'Operating System','Other'] ; /* Obtaining and returning the result */ for(i=0;i<n.length;i++){if(n[i].toLowerCase()== o.toLowerCase().replace('_',' ')){return n[i];}} }; /* Obtaining the full total */ $.findTotal(); /* Looping through all active boxes */ for(i=0;i<o.length;i++) { /* Splitting current box class by spaces */ k = o[i].className.split(' '); /* Looping through each class items */ for(j=0;j<k.length;j++) { /* Checking if this item is equal to itemBox */ if(k[j] == 'itemBox') { /* Setting d as the current box that contains itemBox in the class */ d = document.getElementById(o[i].id); /* If d's display is not empty and doesn't equal none */ if(d.style.display !== '' && d.style.display !== 'none') { /* Setting up the loops global variables */ var h=d.getElementsByTagName('input'),name='', text='',link='',quantity='',price='',run=false; /* Looping through each of the inputs and obtaining the correct information */ for(p=0;p<h.length;p++) { /* If current input name contains [name] and is not disabled */ if(h[p].name.indexOf('[name]') !== -1 && !h[p].disabled) { /* Obtaining the correct name for the current box */ name = getName(h[p].name.match(/computer\[(\w+)\]\[name\]/)[1]); /* IF current input value is not empty and Setting the variable as the current inputs value */ if(h[p].value !== '') {text = ' '+h[p].value;run = true;} /* If current input name contains [link] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[link]') !== -1 && !h[p].disabled && h[p].value !== '') { /* If variable text is not empty output the forum URL and Custom text string */ if(text.substr(1) !== '') {link = ' <a href="'+h[p].value+'" rel="nofollow" target="_blank">'+text.substr(1)+'</a>';} /* If variable text is empty output the forum URL string */ else {link = '" rel="nofollow" target="_blank">'+h[p].value+'</a>';} run = true; /* If current input name contains [quantity] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[quantity]') !== -1 && !h[p].disabled && h[p].value !== '') { /* Setting the variable as the current inputs value */ quantity = ' ('+parseInt(h[p].value)+')'; run = true; /* If current input name contains [price] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[price]') !== -1 && !h[p].disabled && h[p].value !== '') { /* Setting the variable as the current inputs value */ var add = (text !== '' | link !== '' | quantity !== '')?' -':''; price = add+' $'+parseInt(h[p].value); run = true; } } /* Checking if link is not empty, if it is check if text is not empty and if that is then set as empty */ link = (link !== '')?link:(text !== '')?text:''; name = (run)?name+' -':''; /* Add this full string to the global array */ f[n] = "<span>"+name+''+link+''+quantity+''+price+"</span><br/>"; /* Add 1 to the number n */ n++; /* Allowing preview */ preview = true; } } } } if(total && f.join('') !== '') {addExtra+="\n\n<p>Total Price: $"+total+"</p>";} /* If s exists set the innerHTML as the full f array imploded by \n at the end of each array item */ if(s) {for(i=0;i<f.length;i++){if(f[i]!==''){t[i]=f[i];}}s.value=t.join("\n")+addExtra;} /* Updating the total */ $.findTotal(); /* Checking if preview is true */ if(preview && f.join('') !== '') { /* Displaying the preview to the user */ $.preview('display','preview'); } else { /* Hiding the preview from the user */ $.preview('hide','preview'); } }; But for some reason, when I change the part in red, it starts saying undefined: Code: /** * @FUNCTION: finalize :: PUBLIC * This is a shorter version of the codes you * had before and also have a more faster speed */ $.finalize = function(g) { /* Setting global variables */ var i,k,d,p,j,n=0,t=[],f=[],preview=false,addbr='',addExtra='', o=document.getElementsByTagName('div'), s=document.getElementById(g), /* Creating getName function */ getName=function(o){ /* Setting getName global variables */ var i,n= ['Speakers 1','Speakers 2','AMP','Source Comp. 1', 'Source Comp. 2','Source Comp. 3','Other'] ; /* Obtaining and returning the result */ for(i=0;i<n.length;i++){if(n[i].toLowerCase()== o.toLowerCase().replace('_',' ')){return n[i];}} }; /* Obtaining the full total */ $.findTotal(); /* Looping through all active boxes */ for(i=0;i<o.length;i++) { /* Splitting current box class by spaces */ k = o[i].className.split(' '); /* Looping through each class items */ for(j=0;j<k.length;j++) { /* Checking if this item is equal to itemBox */ if(k[j] == 'itemBox') { /* Setting d as the current box that contains itemBox in the class */ d = document.getElementById(o[i].id); /* If d's display is not empty and doesn't equal none */ if(d.style.display !== '' && d.style.display !== 'none') { /* Setting up the loops global variables */ var h=d.getElementsByTagName('input'),name='', text='',link='',quantity='',price='',run=false; /* Looping through each of the inputs and obtaining the correct information */ for(p=0;p<h.length;p++) { /* If current input name contains [name] and is not disabled */ if(h[p].name.indexOf('[name]') !== -1 && !h[p].disabled) { /* Obtaining the correct name for the current box */ name = getName(h[p].name.match(/computer\[(\w+)\]\[name\]/)[1]); /* IF current input value is not empty and Setting the variable as the current inputs value */ if(h[p].value !== '') {text = ' '+h[p].value;run = true;} /* If current input name contains [link] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[link]') !== -1 && !h[p].disabled && h[p].value !== '') { /* If variable text is not empty output the forum URL and Custom text string */ if(text.substr(1) !== '') {link = ' <a href="'+h[p].value+'" rel="nofollow" target="_blank">'+text.substr(1)+'</a>';} /* If variable text is empty output the forum URL string */ else {link = '" rel="nofollow" target="_blank">'+h[p].value+'</a>';} run = true; /* If current input name contains [quantity] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[quantity]') !== -1 && !h[p].disabled && h[p].value !== '') { /* Setting the variable as the current inputs value */ quantity = ' ('+parseInt(h[p].value)+')'; run = true; /* If current input name contains [price] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[price]') !== -1 && !h[p].disabled && h[p].value !== '') { /* Setting the variable as the current inputs value */ var add = (text !== '' | link !== '' | quantity !== '')?' -':''; price = add+' $'+parseInt(h[p].value); run = true; } } /* Checking if link is not empty, if it is check if text is not empty and if that is then set as empty */ link = (link !== '')?link:(text !== '')?text:''; name = (run)?name+' -':''; /* Add this full string to the global array */ f[n] = "<span>"+name+''+link+''+quantity+''+price+"</span><br/>"; /* Add 1 to the number n */ n++; /* Allowing preview */ preview = true; } } } } if(total && f.join('') !== '') {addExtra+="\n\n<p>Total Price: $"+total+"</p>";} /* If s exists set the innerHTML as the full f array imploded by \n at the end of each array item */ if(s) {for(i=0;i<f.length;i++){if(f[i]!==''){t[i]=f[i];}}s.value=t.join("\n")+addExtra;} /* Updating the total */ $.findTotal(); /* Checking if preview is true */ if(preview && f.join('') !== '') { /* Displaying the preview to the user */ $.preview('display','preview'); } else { /* Hiding the preview from the user */ $.preview('hide','preview'); } }; ok i need a bit of advice.. I have a webpage and i want to put a section of another website on to my own website.. The Section i want to put on my website is on this page www.bebo.com/thegaadiscos and i only want to put the section with the comments on it... What i want is a bit like the face book section of this website http://www.alexandraburkeofficial.com/ How would this be done does anyone know.. I was playing around with JavaScript today, just seeing if I could make image rollovers. I successfully switched out the first image, but I couldn't get it switched out with the original. My code: Code: window.onload = initAll; function initAll() { // var nav = document.getElementById("navigation"); var patt = /^http:\/\/www\.[a-z\/\.-]+\.jpe?g$/i; for (var i = 0; i < document.images.length; i++) { if (patt.test(document.images[i].src)) { document.images[i].onmouseover = switchy; var newbySrc = document.images[i].src; document.images[i].onmouseout = function() { UNswitchy(newbySrc); } } } } function switchy() { var newbert = new Image(); // the image below is the same one for every image, as I'm just testing newbert.src = "http://www.hogwarts-rpg.net/images/buttons/home.jpg"; this.src = newbert.src; } function UNswitchy(myImgSrc) { var newBern = new Image(); newBern.src = myImgSrc; this.src = newBern.src; } Since taking the mouse off the image wouldn't switch it back, I guessed that the UNswitchy() function was messing up. So, I commented out the code in there and added alert(), and alert() told me that this.src (in UNswitchy()) was undefined. Why would it be, since it worked fine in switchy()? |