Everything posted by Szitar
-
global and local variables with functions
Example 3 also works if i put the Javascript at the bottom of the page. Thank You for your help!
-
global and local variables with functions
Hello, The following codes are for use with xml data. Example 1 and 2 are working but example 3 does not, even if $x and $cards chould be global variables. I use $ sign before every variable as i found it easier to get around. Please explain why example 3 does not work comment any issues you find. code starts with: if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari $xmlhttp = new XMLHttpRequest(); }else{ // code for IE6, IE5 $xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } $xmlhttp.open("GET","bscard.xml",false); $xmlhttp.send(); $xmlDoc = $xmlhttp.responseXML; example 1: function display() { $x = document.getElementById("test"); $cards = $xmlDoc.getElementsByTagName("BusinessCard"); $cards = getElement(); $name = $cards[0].getElementsByTagName("name")[0].firstChild.data; $phone1str = $cards[0].getElementsByTagName("phone")[0].getAttribute("type") + ": "; $phone1 = $cards[0].getElementsByTagName("phone")[0].firstChild.data; $phone2str = $cards[0].getElementsByTagName("phone")[1].getAttribute("type") + ": "; $phone2 = $cards[0].getElementsByTagName("phone")[1].firstChild.data; $phone3str = $cards[0].getElementsByTagName("phone")[2].getAttribute("type") + ": "; $phone3 = $cards[0].getElementsByTagName("phone")[2].firstChild.data; $email = $cards[0].getElementsByTagName("email")[0].firstChild.data; $x.innerHTML = $name + "<br />" + $phone1str + $phone1 + "<br />" + $phone2str + $phone2 + "<br />" + $phone3str + $phone3 + "<br />" + $email; } examlpe 2: function getElement(){ $x = document.getElementById("test"); $cards = $xmlDoc.getElementsByTagName("BusinessCard"); return $cards; } function display() { $cards = getElement(); $name = $cards[0].getElementsByTagName("name")[0].firstChild.data; $phone1str = $cards[0].getElementsByTagName("phone")[0].getAttribute("type") + ": "; $phone1 = $cards[0].getElementsByTagName("phone")[0].firstChild.data; $phone2str = $cards[0].getElementsByTagName("phone")[1].getAttribute("type") + ": "; $phone2 = $cards[0].getElementsByTagName("phone")[1].firstChild.data; $phone3str = $cards[0].getElementsByTagName("phone")[2].getAttribute("type") + ": "; $phone3 = $cards[0].getElementsByTagName("phone")[2].firstChild.data; $email = $cards[0].getElementsByTagName("email")[0].firstChild.data; $x.innerHTML = $name + "<br />" + $phone1str + $phone1 + "<br />" + $phone2str + $phone2 + "<br />" + $phone3str + $phone3 + "<br />" + $email; } example 3: $x = document.getElementById("test"); $cards = $xmlDoc.getElementsByTagName("BusinessCard"); function display() { $name = $cards[0].getElementsByTagName("name")[0].firstChild.data; $phone1str = $cards[0].getElementsByTagName("phone")[0].getAttribute("type") + ": "; $phone1 = $cards[0].getElementsByTagName("phone")[0].firstChild.data; $phone2str = $cards[0].getElementsByTagName("phone")[1].getAttribute("type") + ": "; $phone2 = $cards[0].getElementsByTagName("phone")[1].firstChild.data; $phone3str = $cards[0].getElementsByTagName("phone")[2].getAttribute("type") + ": "; $phone3 = $cards[0].getElementsByTagName("phone")[2].firstChild.data; $email = $cards[0].getElementsByTagName("email")[0].firstChild.data; $x.innerHTML = $name + "<br />" + $phone1str + $phone1 + "<br />" + $phone2str + $phone2 + "<br />" + $phone3str + $phone3 + "<br />" + $email; }
-
php adding stuff
Hello, Try to put the $_POST['whatever'] in a variable and if it does not work check some string functions on php.net. Please note that using global variables is a big security issue. Regards
-
JavaScript function modification
Hello, I need a JavaScript function modification. This function replaces the content in messages div. I need two variables added to the function so i can call it like replaceContent(var1, var2, var3). var 1 and 2 are numbers, var3 is the name of the div. I would like to use this function in a form with onselect option. Please check function and form example below. Function: function replaceContent(){ //Send an XMLHttpRequest to the 'newcontent.php' file if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET","newcontent.php",false); xmlhttp.send(null); } else{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.open("GET","newcontent.php.php",false); xmlhttp.send(); } //Replace the content of the messages with the response from the 'newcontent.php.php' file document.getElementById('messages').innerHTML = xmlhttp.responseText; } Form: <form> <select name="select1" id="select1"> <option value="1" onselect"replaceContent(var1, var2, var3)"> one </option> <option value="2" onselect"replaceContent(var1, var2, var3)"> two </option> </select> <select name="select2" id="select2"> <option value="1" onselect"replaceContent(var1, var2, var3)"> one </option> <option value="2" onselect"replaceContent(var1, var2, var3)"> two </option> </select> <select name="select3" id="select3"> <option value="1" onselect"replaceContent(var1, var2, var3)"> one </option> <option value="2" onselect"replaceContent(var1, var2, var3)"> two </option> </select> </form> Thank you for your help!
-
Self Employed or Umbrella Company ?
In this case you pay all your profit to yourself by PAYE. Do you have to pay anything other than income tax and NI? Is there any rate to pay if the company employes 2 person? I sow somewhere, there is a 12% rate to pay on egross wages after every employee. Is thistrue?
-
need some help
In this case if a spammer enter a valid but not existed email you still get junk mails. Try loog after a freeware email validation script. Check how it works then write your own.
-
Need help with Mysql query
Thank You! It`s working now!
-
Need help with Mysql query
Thanks for the help. Yes there is a SEO link but the site is my and it is not a part of a paid link building.
-
Need help with Mysql query
Hi all! I have an internet radio website. I need help with a mysql query. I want my result contain only the id`s "WHERE `visible`=1" but i can not work it out. Current query generated by my script: $query = "SELECT * FROM radios WHERE id=10 OR id=32 OR id=42 OR ..."; Please help!
-
Why phpbb header mod doesn`t work?
I installed the forum on my localhost. When i want to refrech it says there is no need to refrach because the files are stored in the file system or something like that. I deleted then installed the style but nothing happened! When i opened and saved the template in phpbbs built in editor (no changes made at all) it worked. Thanks!
-
Why phpbb header mod doesn`t work?
Sorry for foul language!
-
Why phpbb header mod doesn`t work?
I modifed phpbb3 subsilver 2 theme. I want to remove the header but my changes in overall_header.html doesnt have any effect. Any ideas?
-
Desktop monitors vs laptop monitors
Hi! You should look around at the webshops for better prices and hardware. There are many high end stuff. 1920 x 1280 res is normal in the price range above £200. I recommend desktop pc. It is cheaper to upgrade and for a £1000 you get 2 times better stuff then when you buy a laptop. Visit http://www.ebuyer.com , http://www.overclockers.co.uk , http://www.saverstore.com/. Regards
-
Advice needed for Photographer's site
Hi! It is done in flash with XML database. Maybe i can help. Sorry i am busy now i will post again later.
-
Advice needed for Photographer's site
How is your project going on?
-
Advice needed for Photographer's site
He can mess up the gallery if he doesn`t know what and how to do. Please vote my posts above as well. Thanks!
-
Where and how to start my bussiness?
I think we can close this topic because i found someone who explained everything. Thanks folks!
-
Advice needed for Photographer's site
PHP and MySql insalling isn`t hard. You can find very usefull guides on MySql.com and PHP.net. It is recommenden to install both on your PC when you develop the site but you can upload the files every time on the server... That website Lynda.com is good. I paid $30 - $40 / month for waching the videos. I think the photographer will do a big mess with that database. You have a lot of work with the gallery. Plese let me know when you need a hand with the blog. Please vote my post if you like them! ( Green + sign on the right. )
-
Advice needed for Photographer's site
About price. minimum £6 / hour... I would charge a bit more
-
Advice needed for Photographer's site
Yes you can display photos and descriptions with PHP + MySql however you wish to. You don`t need a database for this job but it is recommended to use. Your costumer will be ableto add photos and descriptions in database. If you want to learn PHP buy a book on visit lynda.com I can give a hand with that blog for a small price.
-
getting rid of a line
If you need it asap i can code it for a small price.
-
Advice needed for Photographer's site
Worldpress is free to use. You can download themes for your blog just click here or you can make your style. I am not sure about how to link back the blog to your site.
-
Where and how to start my bussiness?
How much NI do you pay for a year?
-
getting rid of a line
Hi! It is a big mess like that. Why do you use tables there? I think you should read more about CSS. I prefer link the style sheets. When you use internal styles you get a lot of work when you change something. Is the site will be yours or you do it for someone else? I think you should recode it without tables... Regards
-
Advice needed for Photographer's site
Hi! Don`t you think you should do someting with the clog? It looks really bad... Otherways the site is ok so keep up with the good work!