last day (15 days later) » 

21:34
0
A: HTML from a string in a modal box, which can be invoked as a bookmarklet

ProllyGeekanswering your question in a simple way suppose the string you are trying to load into your modal div is called my_string where my_string equals " hi there , im html paragraph element " just use plain JS document.getElmentById("my_div").innerHtml=my_string; or using jquery $("#my_div").ht...

The main catch is that I want this to be invoked through a javaScript Bookmarklet how do I manage that.?
aha got you , this will help you net.tutsplus.com/tutorials/javascript-ajax/… , then you can add any code you want inside the function.
I am trying to create a document out of a string and want that document to load in a modal
so where is the problem ?! would you please be specific
can we chat somewhere..?
21:34
add more comments , and we can turn this to chat :)
ur facebook, can i send u a friend request..?
it is a chat now
and yes you can
bt i prefer talking here though
hi thanks for giving me some time
it is ok
I am new to web dev , very new actually
I have made a js function that would get a string
that string contains something like "<body>....</body>
I would like to create this as a html document and display it in a modal window
could you help me with that.
21:42
yes
can you send full code ?
or just try js fiddle
so we can save time
javascript:(function(){
var test = document.body;
var text = test.textContent;
var bodyStart="<BODY";
var bodyEnd="</BODY>";
var lim1=text.indexOf(bodyStart);
var lim2=text.indexOf(bodyEnd);
var printstr=text.substring(lim1-bodyStart.length,lim2+bodyEnd.length);
var parser = new DOMParser();
return parser.parseFromString(printstr, "text/html");
})();
give me
2 minutes
this is my js code ..!! I want the document to be displayed in a box as it its a html page..!! I don't know how to work out from here.
will answer a question rly quickly
n come back to u
ok thanks
21:59
im here now
okie
you see I create a doc say var doc=parser.parseFromString(printstr, "text/html");
ok i see your code
you dont have to parse
how do i display this doc in a modal window
any variable
can be converted to string
.toStr()
Still don't get you..
22:04
toString()
will convert any variable
to a string
so if i = 5
i.toString() = "5"
ok and second thing
how does it relate to my case
you have your html code ready
right ?
in a string ?
in a string
22:05
and you the modal div
to show your html code
nope i dont know about modals
so why not just use innerHtml = yourstring ?!
let me get this right
u mean a modal like this jqueryui.com/dialog/#modal-message
yes if it can display a web page like a browser
can it..?
yes ofcourse
are you making your own modal div ? or using jquery UI ??
right now I am just starting . I don't want anything custom.
anything very basic that just does the job
will do..!!
22:09
good
what is the id
of your modal div ?
id >>??
you want a dialog to be shown right ? as a modal div on top layer of the page right ?? like the link i have shown you , but your own html
correct ?
give me ur email
and i will send something useful
raina.anurag@gmail.com
22:12
ok hold on
got my mail ?
lemme check
yes
got it
ok so what should i do with this.?
ok it may have some error im sorry
you have
to replace all my local storage with null
wait i wil send you a working version
replace the file in your folder , with this file i have just sent you
and run it
did it work ?
you want something like this ?
hang on
lemme check
22:26
ok
so what is this file..?
this is some html page..
yea
run the template-sample.html
it is a page with modal div that has custom HTML
can you see it ?
ya i can see something like a model box .. with that close button thing
but looks like more of a image ..
yes but close will not work cause i have to edit rest of files , to work on your end , i just want you to ehck if you want something like that
not image !! you can highlight the text already
ya i need a box like that could display my html :)
thats it
yes yes i can highlight.. it..!!
22:31
ok it is very easy to do , first of all you need to create a modal div
after wards just insert the html string inside this div using innerHtml method
do u know jquery ?
no :((
if you are new to developping
learning javascript will take more time than learning jquery
it is very easy , the problem is that you are new to developping so you will not understand what im saying
22:34
so i can send you a quick example , and afterwards you can learn on your own ok ?
ok but first you have to answer my questions
how will you get the string value you want ?
using js
22:36
good , i mean from element that already exists in page ?
i will tell u clearly .. what I am trying to do ..!!
|icon = |alt = HTML |screenshot = |extension = .html, .htm |mime = text/html |type code = TEXT |uniform type = public.html |owner = World Wide Web Consortium & WHATWG |genre = Markup language |container for = |contained by = |extended from = SGML |extended to = XHTML |free = Yes |standard = ISO/IEC 15445[http://www.w3.org/TR/1999/REC-html401-19991224/ W3C HTML 4.01] [http://dev.w3.org/html5/spec/ W3C HTML5] (draft) }} HyperText Markup Language (HTML) is the main markup language for creating web pages and other information that can be displayed in a web browser. HTML is wri...
open this wikipedia page
can you see the code sample `<html>
<head>
<title>This is a title</title>
</head>
<body>
<p>Hello world!</p>
</body>
</html>`
there..???
So I want to display only this code sample in a modal
window
so my modal would only display hello world
Similarly I may do this to any page which has a html sample on the page.
22:39
did you build your html page ?
ya i have one
send it please
to my email
ok wait..!!
i sent you ..!! this is very basic but the actual html page would be having lot of contents between the body tags..!!
so actual page may contain the entire thing in a body tag
23:01
are you there..?
yes sorry was answering some question
your sample doesnt contain a modal div
my sample wont contain a modal div
it would be a page like this
ohh
ok but where is the main page ?
i need extract between body to /body display that in a window
main page can be any random page
for example like the wikipedia page
that contains a html sample
example
no i mean when should it display this ?
when user click a link ?
or what ?
button ?
23:03
bookmarklet
aha a link
you read that right
?
ok hold
i forgot what i read i answered 5 questions while talking to you
sorry :)
one more question
or never mind
okie can it be done
???
yes ofcourse but you said that you have a string of page of your own not external page
cause thre is iframes
if you heard about them !
23:08
I run a js code on any page that gets the <body> to </body> string
if it has any
taheer , Its 5 am at my place . I still haven't slept my mom is about to wake up and i have to goto school too in 3 hours
can i sleep and can we continue this discussin tomorrow
?
I will mail u again
will it be fine
?
ok
and iwill send my code to you
you can sleep now
good night
it is ready now though
if you wanna check it
thank you so much :)
ok send it over
23:24
i did

last day (15 days later) »