Jump to content

wallyson

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by wallyson

  1. in all honesty I did not want to argue, I was just explaining what I meant to say, but quickly jumped off it. All I want to do was help, but unfortunatly some people dont understand that.Flic gratz on your code woring, I know you feel good.
  2. flic, the code that scott100 provided will work just fine for checking the whole form. If you need more help check out the validation tutorial in the w3 area. Try to look at his code, and then mimic it with your style. If your doing something complicated his code may become of no use. Try google searching for a validation js file that can do it all: meaning if a particular field is not filled out, a red markup appears to show which one isnt. that sorta of thing. I see you got it work, no?
  3. What im saying is is that most business corporations who sell a product stick to traditional old standards so that people who have different types of browsers or older versions of browsers can still view the site. html 4.01 is being widely used in most corporations for this very reason.and most of the internet is business of some sort, so back to my statement: who cares if its not written in html vs xhtml.
  4. you dont need / for this to execute, the onClick event works just fine, and what does check() do implied that he shows me the JS hes using. I use alot of DOM for my complex websites, so im used to using this.form and such. As with the return, you are correct in YOUR example, but it doesnt always have to be there.People write different code. who cares about xhtml, I know citigroup, and amazon dont.
  5. Ok, get rid of the that return inside the onClick event.and i also check your code on the site, on the method=post part, there should be " " around postmethod="post" Maybe those will help, and another thing, what does that function check do?
  6. It may becuase there is no submit type and no method in there try this:<form name="myform" id="myform" method="get"><input type="text" name="mytext" id="mytext" /><input type="submit" value="enter text" onclick="showForm(this.form);"></form><script type="text/javascript"><!--function showForm(form1){for(var i=0; i<form1.length;i++){var text = document.getElementById('mytext').value;document.write(text);}}--></script> Ok, over kill a little bit, but I only added the loop incase you have multiple inputs like name, day, country.. so on. Anyways you submit the form with the onclick event to the function showForm. anyways the variable text will get the data (note: use IDs with every input, becuase its easier to get using Jscript) of mytext.Then it simply prints out.
  7. ahh I understand hahaha its easier to just use a div instead.<script type="text/javascript"> document.write('<div class="myclass">Portfolio</div>');</script> and ifyou wnated to get really technical, you could also use innerHTML (DOM) to save the data to a variable that you can pass around via div id in the html.
  8. Try doing the following: Get rid of the onSubmit, and do onClick on teh html submit button, and also do instead of this, do this.form.works for me on my form submits. And you dont really need the back slashes (/) at the end of the inputs.<div id="content"><h1>Email Us</h1><form name="contactform" method=post action="send.php"><p><label for="name" id="namel">Your name: *</label><input class="text" type="text" name="name" /></p><p><label for="email" id="emaill">Your email: *</label><input class="text" type="text" name="email" /></p><p><label for="tel" id="tell">Your phone number:</label><input class="text" type="text" name="tel" /></p><p><label for="ref" id="refl">Your reference:</label><input class="text" type="text" name="ref" /></p><p><label for="enq" id="enql">Your enquiry: *</label><textarea name="enq"></textarea></p><p> </p><p><input type="submit" value="Send Email" onClick="return check(this.form);"/></p></form></div>
  9. If you explain a little better, I know I can help you.
  10. The post above your post is using the innerHTML feature. which all the data is sent to the div ID. in the html page, simply have a div with the id= whatever the id was. and all the data should be displayed there.ps. how does the editer not recognize javascript DOM?
  11. Very nice, now you should add the page show.php with maybe a switch or somethin, to show how its gettin the data and then returning it.
  12. Ha I ended up figuring it out. I simply added in an ID in the two input fields.Then getElementById it. Thanks for helping me out though, your first post helped themost. hahahaWally
  13. OK here is what I have using DOM to create some multiple input boxes:<html><script>var annouceInputs = 1;////////////////////////////Creates new announcement //////////////////////////function addAnnounce(){ var table = document.getElementById('annoucementData'); var tr = document.createElement('TR'); var td2 = document.createElement('TD'); var td3 = document.createElement('TD'); var inp1 = document.createElement('INPUT'); //url for announcement var inp2 = document.createElement('INPUT'); //headline for announcement var breaks= document.createElement('br'); var inp3 = document.createElement('INPUT'); // delete "-" button var p1 = document.createElement('p'); var p2 = document.createElement('p'); var inp4 = document.createElement('INPUT'); var break2 = document.createElement('br'); if(annouceInputs>0) { var img = document.createElement('IMG'); inp3.setAttribute('type', 'button'); inp3.setAttribute('value', '-'); inp4.setAttribute('type', 'button'); inp4.setAttribute('value', '+'); p1.className='delete'; inp1.className= 'delete'; inp2.className= 'delete'; td3.appendChild(inp4); td3.appendChild(break2); inp3.onclick = function() { removeElement(tr); } inp4.onclick = function() { addAnnounce(); } td3.appendChild(inp3); } inp1.setAttribute("name", "announceUrl"+annouceInputs); inp1.setAttribute("value", "URL"+annouceInputs); inp2.setAttribute("Name", "annouceHeadline"+annouceInputs); inp2.setAttribute("value", "Headline"+annouceInputs); table.appendChild(tr); td2.style.paddingLeft = "50px"; tr.appendChild(td2); tr.appendChild(td3); td2.appendChild(inp1); td2.appendChild(breaks); td2.appendChild(inp2); annouceInputs++;}////////////////////////////////Removes the new Child element//////////////////////////////function removeElement(tr){ tr.parentNode.removeChild(tr);}</script><body onload="addAnnounce();" > <br /><br /><FORM NAME="myform" ACTION="#" METHOD="GET"><table> <tr> <th><p>Email Generator</p></th> </tr> <tr> <td style="padding-left: 50px;"> <input class="delete" type="text" name="date" value="Date"> </td> </tr> <tr> <th align="left"><p>Announcements</p></th> <td valign="top"> <input type="button" value="+" onClick="addAnnounce();"> </td> </tr> <tr> <tbody id="annoucementData" valign="top" border="1"> </tbody> </tr></table></FORM></body></html> Ok you can pretty much copy and paste that into a temp page, and view what it does.I got it to do what I want, but now Im having trouble actually collecting the data.How do I get the data from the multiple input boxes now that I have created them?Please help.Wally
  14. Hello, I am trying to create multiple input boxes in sets of 2 (one is for url, and the other for headline).Now the tricky part is that, There is a "+" button and a "-" button. If a user clicks on the "+" a new set of input boxes appear. and if they user clicks the "-" they input boxes go away.How do I do this in Jscript. Ill show a little of my code. var cfields= new Array();var x = 0;function showFields(){ var divID= 'results'; var output=''; output+= '<div style="border: 1px solid; width: 151px;padding: 3px;" id="announcements"><input type="text" value="URL"><br>'+ '<input type="text" value="Headline"></div>'; output+=''; document.getElementById(divID).innerHTML = output;}///////////////////////////////////////////////////////////////////////////////function newField(){var foo = new showFields();cfields.push(foo);alert(cfields);x++;}</script><body> <!--<a href="#" onClick="showFields();">Click here</a><a href="#" onClick="newField();">new Field</a>--><br /><br /><table> <tr> <th><p>Email Generator</p></th> </tr> <tr> <td> <div style="border: 1px solid; width: 151px;padding: 3px;"><input type="text" value="Date"></div> </td> </tr> <tr> <th align="left"><p>Announcements</p></th> </tr> <tr> <td> <div style="border: 1px solid; width: 151px;padding: 3px;" id="announcements'+x+'"><input type="text" value="URL"><br> <input type="text" value="Headline"></div> <div id="results"></div> </td> <td valign="top"> <div style="border: 1px solid; width: px;padding: 3px;" align="center"><input type="button" value="+" onClick="showFields();"><br> <input type="button" value="-"></div> </td> </tr> <tr> <th align="left"><p>Press Release</p></th> </tr> <tr> <td> <div style="border: 1px solid; width: 151px;padding: 3px;" id="announcements'+x+'"><input type="text" value="URL"><br> <input type="text" value="Headline"></div> </td> <td valign="top"> <div style="border: 1px solid; width: px;padding: 3px;" align="center"><input type="button" value="+"><br> <input type="button" value="-"></div> </td> </tr> <tr> <th align="left"><p>In the Press</p></th> </tr> <tr> <td> <div style="border: 1px solid; width: 151px;padding: 3px;" id="announcements'+x+'"><input type="text" value="URL"><br> <input type="text" value="Headline"></div> </td> <td valign="top"> <div style="border: 1px solid; width: px;padding: 3px;" align="center"><input type="button" value="+"><br> <input type="button" value="-"></div> </td> </tr> <tr> <th align="left"><p>Point of View</p></th> </tr> <tr> <td> <div style="border: 1px solid; width: 151px;padding: 3px;" id="announcements'+x+'"><input type="text" value="URL"><br> <input type="text" value="Headline"></div> </td> <td valign="top"> <div style="border: 1px solid; width: px;padding: 3px;" align="center"><input type="button" value="+"><br> <input type="button" value="-"></div> </td> </tr> <tr> <th align="left"><p>World Online</p></th> </tr> <tr> <td> <div style="border: 1px solid; width: 151px;padding: 3px;" id="announcements'+x+'"><input type="text" value="URL"><br> <input type="text" value="Headline"></div> </td> <td valign="top"> <div style="border: 1px solid; width: px;padding: 3px;" align="center"><input type="button" value="+"><br> <input type="button" value="-"></div> </td> </tr></table></body></html> I tryed to make an array and stuff a new set in the array. Im sure this is not how its done.If anybody could help I would appreciate it.Thanks,Wally
  15. Hey man, Thanks for the help! I actually got it all to work now. I used javascript algo to fix my duplicate problem, and I also used the bubble sort to sort it by day (1, 2, 3 ....) You were very helpful.Again thanks much,Wally
  16. Hey thanks alot, I actually figured it out on my own. I ahd tried an original method that didnt work, I got so frustrated I went back to the old set up and changed things around. I ended up creating a new array and placing all the elements inside of it. Here look at it: var temp2 = new Array();////////////////////////////////////// This removes duplicates in the array.///////////////////////////////////for (var x = 0; x < result.length; x++) { for(var y=0; y < result.length; y++) { if((result[y][2] == result[x][2]) && (result[y][1] == result[x][1])) { temp2[y]=result[y]; break; } }} Yup thats all i did. After that I used the bubble sort to sort the array by day (1 2 3 4 5....) You get the idea.I spent a week and half trying other methods such as xsl and xpath. Man it was a simple 1 line of code.hahahha
  17. DOES ANYBODY KNOW HOW TO REMOVE DUPLICATES FROM AN XML JAVASCIRPT ARRAY!!! IM GOING CRAZY HERE! HA.
  18. th js way still incorporates the xpath way but its only a string like:nodes = xmldoc.selectNodes("Holiday/Data[Month = 'August']");I have tried that and it works, printing out all the holidays in August. but then again getting rid of duplicates im not good with the xpath syntax so I wouldnt even no where to begin with an xpath expression to check and stuff.
  19. Let me rework my question. To make it easier, I want to get rid of the duplicates inside my xml array. I tried using a duplicate method, but it only works on single dimentional arrays.But, I want to try making an alt. array and sorting the unique ones inside it (I guess) like you mentioned above. I may need help. I get on it really quick and then post back.
  20. Im not sure if I can use a template with what im doing. inside the html page, I use javascript to load a xml file, then i do: nodes = xmldoc.selectNodes("xpath query goes here");nodes is then going to have the xml data that is sorted. its basicaly xsl in javascript (sorta) becuase its using xpath to make the quieries. so Im thinking loading a template is out of the question. which leads me to this question, is there a duplicate query that will work with this.
  21. thanks, well I am still using xpath to do my deeds. Now im having troulbe creating a no dupelicates query. becuase thats basically what this is, I dont want any duplicates to print out.im using javascript to make the query. Do you know of any good get rid of duplicate sorts?
  22. Ok here is my xml that im parsing using a parer: <?xml version="1.0" encoding="UTF-8"?><!-- Edite with [somekind of software] --><Holidays> <Data> <Month>August</Month> <Day>2</Day> <Holiday>Virgin of the Angels Day</Holiday> <Country>(CR)</Country> <Year>2006</Year> </Data> <Data> <Month>August</Month> <Day>3</Day> <Holiday>Fast Tishaa Beav</Holiday> <Country>(ISR)</Country> <Year>2006</Year> </Data> <Data> <Month>August</Month> <Day>3</Day> <Holiday>San Salvador Day</Holiday> <Country>(SLV)</Country> <Year>2006</Year> </Data> <Data> <Month>August</Month> <Day>4</Day> <Holiday>San Salvador Festival</Holiday> <Country>(SLV)</Country> <Year>2006</Year> </Data> <Data> <Month>August</Month> <Day>2</Day> <Holiday>Virgin of the Angels Day</Holiday> <Country>(IRL)</Country> <Year>2006</Year> </Data> </Holidays> Ok so its an xml file full of holidays, dates, and months. easy enoughOK when a user selects a particular Month from a drop down menu, all the holidays that are with in that month should appear. I have this part working. Now what I want to do is only display 1 instance of a holiday example: If i have 15 Christmas's in December I only want 1 Christmas to show up, not all 15 here is my code now: function showHolidays(pass){var heys = new Array();heys = pass.split(' ');var theDiv= "results";var cats = new Array('Month','Day','Holiday','Country','Year' );var output = ' ';result = parseXML('holidaysxml.xml', true, cats, 'Month', heys[0]);output += '<p><font color="white">'+heys[0]+' '+heys[1]+'</font></p>'+'<p><font color="white"> Holidays</font></p>'+'<ul>';for (var x = 0; x < result.length; x++) { if(result[x][0] == heys[0]) { var holy = "'"+result[x][2]+"'"; var moly = "'"+pass+"'"; var soly = "'"+result[x][1]+"'"; var hello = "'"+result[x][3]+"'"; output +='<li style="color: white;"><a href="#" class="Select" onClick="showCountries('+holy+','+moly+','+soly+','+hello+');" >' + result[x][2] +' - '+ pass+' / ' + result[x][1]+'</a></li></div>' }//if}//outer foroutput += '</ul>';document.getElementById(theDiv).innerHTML = output;} That code will simply print out every holiday in the month of whatever the user selects. I only want to print out 1 instance of each holiday if there are more than 1 holiday if they have the same name and day.Please help.Wally
  23. Hey man I really appreciate all your help, I simply started over and using a jscript parser I have already made. xsl is really nice, but man do they need to modify it so that it can understand other languages. Its ok when your not using javascript so much with hard functions. I even had a jscript and xsl guy of like 10 years help me out, and we couldnt figure it out. Sad to say, but I probably wont be using xsl again, simply becuase its a headache when the code gets complicated. Still kool non the less.
  24. Check this out.function showCountries(pass){ var results =''; var sendtoDIVid = "requests"; ']]><xsl:variable name="fool">'+pass+'</xsl:variable><![CDATA[';// convert pass to xsl variable switch(pass) { case pass: results +='<p style="color: Navy">Countrys</p>'+ '<p style="color: Navy">'+pass+' 2006</p>'+ '<ul>'+ ']]><xsl:for-each select="Holidays/Days/Data[Holiday = $fool]"><![CDATA['+ //Holiday checks agaisnt xsl variable $fool. '<li style="color: navy">'+']]><xsl:value-of select="Country"/><![CDATA[</li>'+//the countries of that holiday print out. ']]></xsl:for-each><![CDATA['+ '</ul>'+ '</table>'; document.getElementById(sendtoDIVid).innerHTML = results; break; default: }} I converted the jscript pass variable into a xsl variable, then I use that. BUT it doesnt work, but I know my logic is correct, cas when you take this: ]]><xsl:variable name="fool">'+pass+'</xsl:variable><![CDATA[';// convert pass to xsl variableand change it like this:]]><xsl:variable name="fool">Emancipation Day</xsl:variable><![CDATA[';// convert pass to xsl variableThe stupid thing works!!!!!!????!!! Oh man Im about to start over and simply use a jscript parser I already have. This if my first time with xsl and I really dig it alot cas its so simple. I dont want to start over.
  25. I did that and it seems to work, but when I alert the pass value to check it, its empty. The pass is empty.
×
×
  • Create New...