I have a blog template that I downloaded for use on my blogger account, and I was having some trouble with an undefined box that's supposed to display the date for each post. I'm more keen on HTML than JS, so I was wondering if anyone could help me with it. I attached a picture of the box in question, and here's the part of the code which I believe is the problem. function rp(json){document.write('<ul>');for(var i=0;i<numposts;i++){document.write('<li>');var entry=json.feed.entry[i];var posttitle=entry.title.$t;var posturl;if(i==json.feed.entry.length)break;for(var k=0;k<entry.link.length;k++){if(entry.link[k].rel=='alternate'){posturl=entry.link[k].href;break}}posttitle=posttitle.link(posturl);var readmorelink="(more)";readmorelink=readmorelink.li nk(posturl);var postdate=entry.published.$t;var cdyear=postdate.substring(0,4);var cdmonth=postdate.substring(5,7);var cdday=postdate.substring(8,10);var monthnames=new Array();monthnames[1]="Jan";monthnames[2]="Feb";monthnames[3]="Mar";monthnames[4]="Apr";monthnames[5]="May";monthnames[6]="Jun";monthnames[7]="Jul";monthnames[8]="Aug";monthnames[9]="Sep";monthnames[10]="Oct";monthnames[11]="Nov";monthnames[12]="Dec";if("content"in entry){var postcontent=entry.content.$t}else if("summary"in entry){var postcontent=entry.summary.$t}else var postcontent="";var re=/<\S[^>]*>/g;postcontent=postcontent.replace(re,"");document. write(posttitle);if(showpostdate==true)document.wr ite(' - '+monthnames[parseInt(cdmonth,10)]+' '+cdday);if(showpostsummary==true){if(postcontent. length<numchars){document.write(postcontent)}else{ postcontent=postcontent.substring(0,numchars);var quoteEnd=postcontent.lastIndexOf(" ");postcontent=postcontent.substring(0,quoteEnd);d ocument.write(postcontent+'...'+readmorelink)}}doc ument.write('</li>')}document.write('</ul>')} 7 1947
how do call that function on the page? (this function has only very limited use)
I'm not sure what it's called. The only info about the function that I could find was in the code above. If you like, I could attach the whole template HTML.
I only need the part of the HTML, where this function is in.
PS. calling a function means to execute it. ex. <img src="…" onclick="doSomething()"> or document.getElementById("test").onclick = doSomething;
I looked all through and this is all I could find that might be relevant: - function removeHtmlTag(strx,chop){
-
if(strx.indexOf("<")!=-1)
-
{
-
var s = strx.split("<");
-
for(var i=0;i<s.length;i++){
-
if(s[i].indexOf(">")!=-1){
-
s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length);
-
}
-
}
-
strx = s.join("");
-
}
-
chop = (chop < strx.length-1) ? chop : strx.length-2;
-
while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++;
-
strx = strx.substring(0,chop-1);
-
return strx+'...';
-
}
-
-
function createSummaryAndThumb(pID){
-
var div = document.getElementById(pID);
-
var imgtag = "";
-
var img = div.getElementsByTagName("img");
-
var summ = summary_noimg;
-
if(img.length>=1) {
-
imgtag = '<span style="float:left; padding:0px 10px 5px 0px;"><img src="'+img[0].src+'" width="'+img_thumb_width+'px" height="'+img_thumb_height+'px"/></span>';
-
summ = summary_img;
-
}
-
-
var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>';
-
div.innerHTML = summary;
-
}
-
-
//]]>
-
</script>
Sorry if that isn't what you're looking for; I don't have too much of an eye for JS coding. If it helps, here's the rest of the template code in an attachment.
hm, I don’t see the rp() function used anywhere. do you have a live page by chance?
Yup! It's kingdomeyes.blogspot.com
Oh, I just fixed it. Turned out it wasn't a JS problem, but a settings issue. Sorry for the trouble and thanks for the help!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Davide Bruzzone |
last post by:
Greetings all...
Here's a description of the problem that I'm trying to solve:
- I have a Web page from which users can open one or more other
windows.
- From that web page, the user can then...
|
by: Peter Bremer |
last post by:
Hi all,
I've written this little piece of code, which doesn't seem to work in
Mozilla 1.5. I haven't tried it on other Gecko browsers, but I've found
some indication that Netscape 6+ has the...
|
by: joebob |
last post by:
The following script if run in Internet Explorer should
display a thumbview of a webpage that you point it to.
To test it, replace test.htm with a valid html file.
The problem I'm having is that...
|
by: Ophir |
last post by:
Hello all
I have this problem:
I'm displaying a loggin page.
If the user entered an invalid UserName/Password I display the page
again.
When this happens I want to give the user a different...
|
by: Ian Renfrew |
last post by:
Does Javascript supply a function that destroys an object? If so, is there a
dependancy on Javascript version?
Thanks in advance, Ian Renfrew
|
by: Roman Ziak |
last post by:
Hello,
there were times when I used to be looking for a way to access
JavaScript Global object similar to those found in VBScript or PHP
($GLOBALS). At present this has only academic value for...
|
by: Jim Ox |
last post by:
I have created a custom validator control that implements the
BaseValidator. However I would like to add an attribute to the
JavaScript validation object that is rendered at the bottom of the...
|
by: Hoss |
last post by:
Hello- I have the following Javascript code
function Obj()
{
obj.squares = new Array();
}
Obj.prototype.Load= function(xdoc)
{
var goat = "head";
xdoc.ProcessNodes("squares/square",...
|
by: kieran5405 |
last post by:
i am fairly unfamilar with javascript...i get the following error
message on the below code...can anyone tell me how to remove the
error.
'iLoopCounter' is undefined
Thanks...
|
by: ismailc |
last post by:
Good day,
I thought i had this sorted but it does not seem to check if the object is undefined / not created.
I'm trying to check if object is undefined & i tried a few methos but no luck...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |