Help adding code block on my blog?

  • #1
aheight
321
109
I was wondering if you guys could help me design (code) a slick code block in my blog like the one here that the reader could scroll? I'm very new to HTML and Java but if I could get just a little help, I would work on it. I really don't have a clue how to add the following to my HTML file but I did get several HTML references. Perhaps someone could direct me to a particular HTML topic?
Code:
ringNum = 1
mnum = 1
baseRoot = 0;
wOffset = 0
nmax = 15;
{rmin, rmax, wstart, wend} = theInitialValues[[ringNum]];
loopmax = 2 \[Pi] totalSheets;
theorder = manifoldOrders[[ringNum, mnum, 2]];
Print["Order is: ", theorder];
rangemin = theInitialValues[[ringNum, 1]];
rangemax = theInitialValues[[ringNum, 2]];
rd = (rmax - rmin)/10;
rstart = rmin + rd;
rend = rmax - rd;
rnorm = (rmin + rmax)/2;
z0 = 0;
tval = thetStart;
wSheet = theFunctionRoots[[manifoldOrders[[ringNum, mnum, 1]]]];
wSheet = theFunctionRoots[[11]];
myRadialTable = {\[Psi][\[Rho]] /.
    NDSolve[{theRhoDeriv /. \[Theta] -> tval, \[Psi][
        rnorm] == (wSheet /.
         z -> rnorm Exp[I tval])}, \[Psi], {\[Rho], rnorm,
      rstart}], \[Psi][\[Rho]] /.
    NDSolve[{theRhoDeriv /. \[Theta] -> tval, \[Psi][
        rnorm] == (wSheet /.
         z -> rnorm Exp[I tval])}, \[Psi], {\[Rho], rnorm, rend}]};
Print["testa"];
Clear[xcod, xdcod, ycod, ydcod];
rnum = rnorm;
xcod[t_] := rnum Cos[t];
xdcod[t_] = \!\(
\*SubscriptBox[\(\[PartialD]\), \({t}\)]\(xcod[t]\)\);
ycod[t_] := rnum Sin[t];
ydcod[t_] = \!\(
\*SubscriptBox[\(\[PartialD]\), \({t}\)]\(ycod[t]\)\);
tstart = tval;
tend = tval + 2 theorder \[Pi];
Clear[mysol, myw];
Print["tset1"];
mysol = First[
   NDSolve[{theThetaDeriv /. \[Rho] -> rnum, \[Psi][tstart] ==
      First[(myRadialTable[[2]] /. \[Rho] ->
          rnum)]}, \[Psi], {\[Theta], tstart, tend},
    MaxStepSize -> 0.001, MaxSteps -> 500000]];
myw[t_] := Evaluate[\[Psi][t] /. mysol];
myVarw[t_] :=
  Piecewise[{{myw[t],
     t <= 2 theorder \[Pi]}, {myw[t - 2 theorder \[Pi]],
     t > 2 theorder \[Pi]}}];
Print["test3"];
If[theorder > 1,
  {
   baseSol =
    NDSolve[{f'[t] == (-rnum Sin[t] + I rnum Cos[t])/(
       theorder f[t]^(theorder - 1)) ,
      f[tstart] ==
       Exp[(2 \[Pi] I baseRoot)/theorder] Power[rnum Exp[tstart I],
         1/theorder]}, f, {t, tstart, tend}];
   theBaseM[t_] := Evaluate[f[t] /. baseSol];
   }
  ,
  theBaseM[t_] := rnum Exp[I t];
  ];
thealist1 = Table[
  n1 = NIntegrate[(xdcod[t] +
       I ydcod[t])/(theBaseM[t])^((j + theorder)) myw[
      wOffset + t], {t, tstart, tend}, MaxRecursion -> 20];
  If[Length[n1] == 1,
   {j, First[N[1/(2 theorder \[Pi] I) (n1)]]},
   {j, N[1/(2 theorder \[Pi] I) (n1)]}
   ], {j, -nmax, nmax}]
Sent from Mail for Windows 10
 
Last edited:
Technology news on Phys.org
  • #2
Seriously? We're supposed to figure out what that code does?

If you are just trying to add a scrollable window to a web page, that's just some javascript.
 
  • #3
I am really sorry for that. Didn't mean to imply I needed help with that code. I just gave an example of a long bunch of code to make the window scroll.

Yes, I'm trying to add a scrollable window to the web page.
 
  • #4
aheight said:
I am really sorry for that. Didn't mean to imply I needed help with that code. I just gave an example of a long bunch of code to make the window scroll.

Yes, I'm trying to add a scrollable window to the web page.
I think you need to read a quick tutorial on HTML. This can be done using one simple tag
http://www.w3schools.com/tags/tag_iframe.asp
 
  • #5
Oh wow, I just googled "how to add a scrollable window to web page:

HTML:
<div style="width:150px;height:150px;line-height:3em;overflow:auto;padding:5px;">
This 'div' element contains more content than the previous one. Because there's too much text to fit into the box, the box grows scrollbars.
</div>

I really didn't even know what to google for. I'll work on these. Thanks guys.
 
  • Like
Likes Greg Bernhardt
  • #6
If you want just a scrollable table, then Greg's code works great. If you want a non-scrolling header, it gets more complicated and is what I was talking about when I said it was JavaScript. Here's an example. Just view the source code of this page:

http://www.imaputz.com/cssStuff/bigFourVersion.html
 
  • #7
phinds said:
If you want just a scrollable table, then Greg's code works great. If you want a non-scrolling header, it gets more complicated and is what I was talking about when I said it was JavaScript. Here's an example. Just view the source code of this page:

http://www.imaputz.com/cssStuff/bigFourVersion.html

Can I please ask how do I view the source code for that page? I know if I select from my browser "more tools/developer tools" I get some sort of html viewer but that doesn't look like all of that code. Is that how I view all of the code for bigFourVersion.html?

I do like keeping the headers visible in some applications.
 
  • #9
Greg Bernhardt said:
Right click and then select view source

Thanks. Didn't notice that option and it's nicely formatted too. Although the <iframe> block looks nice, the <div> block is is not a bad start for me although I do have to manually add the <br/> commands:
HTML:
<div style="width:550px;height:150px;line-height:1.5em;
overflow:auto;padding:5px;font:12pt;font-family: monospace; color: black;background: bisque">
too much text to fit into the box, the box grows scrollbars. <br/>
ringNum = 1<br/>
mnum = 1<br/>
baseRoot = 0;<br/>
wOffset = 0<br/>
nmax = 15;<br/>
{rmin, rmax, wstart, wend} = theInitialValues[[ringNum]];<br/>
loopmax = 2 \[Pi] totalSheets;<br/>
Clear[mysol, myw];<br/>
Print["tset1"];<br/>
mysol = First[<br/>
   NDSolve[{theThetaDeriv /. \[Rho] -> rnum, \[Psi][tstart] == <br/>
      First[(myRadialTable[[2]] /. \[Rho] -> <br/>
          rnum)]}, \[Psi], {\[Theta], tstart, tend},<br/>
    MaxStepSize -> 0.001, MaxSteps -> 500000]];<br/>
myw[t_] := Evaluate[\[Psi][t] /. mysol];<br/>
myVarw[t_] := <br/>
  Piecewise[{{myw[t],<br/>
     t <= 2 theorder \[Pi]}, {myw[t - 2 theorder \[Pi]],<br/>
     t > 2 theorder \[Pi]}}];<br/>
Print["test3"];<br/>
</div>
 
Back
Top