How to combine these examples?

First of all, I would like to apologize for reporting this again. I am new to this forum. In addition, I cannot comment on comments on the first post of this question or send private messages to users who commented, so I cannot communicate normally with anyone who is trying to help. How can I communicate with people who can comment or reply to this post? Again, I am sorry to repeat this question. From this side I am moving on.


I am just experimenting with Javascript, so my knowledge about this is small. I found a website that offers a guestbook tool ( http://www.bfnsoftware.com/index.php?eid=2013 ) and another is a star rating tool (addratings.com/). I would like to know which parts of the scripts to change and what to change, so that the result becomes a star rating tool under each new comment. By the way, I had to resort to scripts that are not hosted on my site, due to file type restrictions on my web host.

The guestbook code consists of two parts. The first is the input form. It is in it that there is a basic form:

<form action = "http://www.bfnsoftware.com/cgi-bin/home/Members/Guestbook/Guestbook.cgi?SiteID=30185&Book=3128" method = "POST"> <input type = "hidden" name = "action" value = "sign"> :: Guestbook :: Name: <input type = "text" name = "guestName" size = 30 maxlength = 60> Email Address: <input type = "text" name = "guestEmail" size = 30 maxlength = 100> Website: <input type = "text" name = "guestWebsite" size = 30 maxlength = 150> Vote: <select name = "guestVote" style = "width:203px;"> <option value = "0"> 0 - Worst <option value = "1"> 1 <option value = "2"> 2 <option value = "3"> 3 <option value = "4"> 4 <option value = "5" SELECTED> 5 - Average <option value = "6"> 6 <option value = "7"> 7 <option value = "8"> 8 <option value = "9"> 9 <option value = "10"> 10 - Best </select> :: Message :: <textarea cols = 45 rows = 6 name = "guestMessage"></textarea> <input type = "submit" value = "Submit"> </form> 

I do not use the "guestWebsite", "guestEmail" or "guestVote" form fields on my site. I was able to choose that users enter html in the text field of "guestMessage".

This is the second part of the guestbook code. I put it on the page that I would like messages to be parsed.

 <script language = "JavaScript" src = "http://www.bfnsoftware.com/cgi-bin/home/Members/Guestbook/Guestbook.cgi?SiteID=30185&Book=3128&action=js"> </script> <script language = "JavaScript"> document.write("<font size = 3><b>" + Title + "</b></font><br>"); document.write("<hr align = left color = #4F4F4F width = 400><p>"); for (nextE = 0; nextE < FilledEntries; nextE++) { document.write('<table border = 0 cellpadding = 1 cellspacing = 0 width = 502 bgcolor = #000000><tr><td width = 502>'); document.write('<table border = 0 cellpadding = 0 cellspacing = 0 width = 500 bgcolor = #DFDFDF>'); document.write('<tr><td width = 10></td><td width = 100> Name:</td><td width = 390>' + GuestName[nextE] + '</td></tr>'); document.write('<tr><td width = 10></td><td width = 100> E-mail: </td><td width = 390>' + GuestEmail[nextE] + '</td></tr>'); document.write('<tr><td width = 10></td><td width = 100> Website:</td><td width = 390><a href = ' + GuestWebsite[nextE] + '>' + GuestWebsite[nextE] + '</a></td></tr>'); document.write('<tr><td width = 10></td><td width = 100> Vote:</td><td width = 390>' + GuestVote[nextE] + '</td></tr>'); document.write('<tr><td width = 10></td><td width = 100> Date:</td><td width = 390>' + GuestDate[nextE] + '</td></tr>'); document.write('</table></td></tr><tr><td>'); document.write('<table border = 0 cellpadding = 0 cellspacing = 0 width = 500 bgcolor = #DFDFDF>'); document.write('<tr><td width = 10></td><td width = 100 valign = top>Message:</td><td width = 390>' + GuestMessage[nextE] + '</td></tr></table>'); document.write('</td></tr></table><p>'); } </script> <noscript> <a href = "http://www.bfnsoftware.com/cgi-bin/home/Members/Guestbook/Guestbook.cgi?SiteID=30185&Book=3128&action=view">View Guestbook</a> </noscript> 

I changed it like this:

 <script language = "JavaScript" src = "http://www.bfnsoftware.com/cgi-bin/home/Members/Guestbook/Guestbook.cgi?SiteID=30185&Book=3128&action=js"> </script> <script language = "JavaScript"> document.write("<b>" + Title + "</b><br />"); for (nextE = 0; nextE < FilledEntries; nextE++) { document.write('<div class="entry">Username: ' + GuestName[nextE] + '<br />'); document.write('Submission Date: ' + GuestDate[nextE] + '<br />'); document.write('Line Submission: ' + GuestMessage[nextE] + '<br /><br />'); document.write('</div>'); } </script> 

Next is the stars rating of the script. Here is what I use:

 <script type='text/javascript'> aR_BgColor=""; aR_FgColor=""; aR_url=location.href + ""; aR_title=document.title + ""; aR_StarType ='1'; document.write('<div id="aR_star_info" class="aR_star_info"></div>'); document.write('<scr'+'ipt type="text/JavaScript" src="http://addratings.com/aR_BootStrap.js"></scr'+'ipt>'); </script> 

The site explained that if I wanted to use the code more than once on one page, I could, but I would need to define a unique value + " part aR_url = location.href +" "; as follows: +" 1 " for each code instance, or all results will be the same for each instance.

So, my question is again: β€œWhat parts of the scripts do I need to change and what should I change so that the result is a star rating tool for each new mail client?”, In advance for any help I can get.

+4
source share
1 answer

you can have every new message - this is an instance of a star rating, so you can have a counter for it, for example:

post.js

 function post() { var rating; this.increase_rating() = function() {..} } 

in the main script, var newpost = new post ();

then when someone clicks the button to enlarge the star, he [ onClick=newpost.increase_rating() ]

Well, if you copy the location src = "http", you can get the source code for the guestbook, which you could not previously edit

here, by the way, you can copy and paste into your .js file and include and edit as you need

 var Entries = 3; var Title = "book1"; var GuestName = new Array(Entries); var GuestEmail = new Array(Entries); var GuestVote = new Array(Entries); var GuestDate = new Array(Entries); var GuestWebsite = new Array(Entries); var GuestMessage = new Array(Entries); var FilledEntries = 0; function AddEntry(Name, Date, Email, Vote, Website, Message) { GuestName[FilledEntries] = unescape(Name); GuestDate[FilledEntries] = unescape(Date); GuestEmail[FilledEntries] = unescape(Email); GuestVote[FilledEntries] = unescape(Vote); GuestWebsite[FilledEntries] = unescape(Website); GuestMessage[FilledEntries] = unescape(Message); FilledEntries++; } AddEntry("RatETest", "6/1/2010 09:29:46 pm", "", "0", "http://", "Rate test 1"); AddEntry("Test", "6/1/2010 07:03:07 pm", "", "0", "http://", "Message 2"); AddEntry("test1", "6/1/2010 06:21:44 pm", " strangedays@mobilestimulus.com ", "5", "http://www.mobilestimulus.com", "Testing the guestbook feature"); 

and you can change this to add variables inside the function itself and make each post an object. You can also add functions to another site using the same method (find the address in their .js or use the page source) and put it in this file.

+2
source

Source: https://habr.com/ru/post/1311796/


All Articles